home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / NGL2.0.1J(68k).sit / NGL2.0.1J(68k) / Audio Sample / Audio_Sample.c < prev    next >
C/C++ Source or Header  |  1996-09-15  |  1KB  |  44 lines

  1. /*============================================================
  2.  
  3.                   N-Music/Sound サンプルプログラム
  4.                     
  5. ============================================================*/
  6.  
  7. #include        "N_Library.h"
  8.  
  9. short        Data_Rsrc = 0;
  10. short        Sounds[] = { 9000,0 };        //使用するサウンドリソース ID 
  11. short        Music1[] = { 9000,-1 };        //Music 1 の演奏する順番 9000 が終われば 1つ戻ってループ
  12.  
  13. void main(void)
  14. {
  15.     WindowPtr    window;
  16.  
  17.     ToolboxInit();
  18.     ColorCheck();
  19.     HideMenuBar();
  20.     window = GetNewWindow (128,nil,(WindowPtr)-1L );
  21.     N_Window_Set(window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),320,240);
  22.     Open_Resource_File(128,1,&Data_Rsrc);
  23.     N_Pict_Draw(128,0,0,(GrafPtr)window,true);
  24.     N_Sound_Load(&Sounds[0]);                                //使用するサウンドを読み込んで、チャンネルを初期化する
  25.     Close_Resource_File(&Data_Rsrc);
  26.     N_Music_Set(1,&Music1[0]);                                //Music 1 をセットする(0 は 演奏停止用なので指定しないでください)
  27.     N_Music_Play(1);                                        //Music 1 を演奏する(0を指定すると音楽の演奏をさせます)
  28.     do
  29.     {
  30.     }
  31.     while (!Button());
  32.     N_Music_Out(180);                                        //3秒でフェードアウト
  33.     do
  34.     {
  35.     }
  36.     while (FO_Flag == true);                                    //フェードアウトが終わるのを待つ
  37.     N_Music_Kill();                                            //必ず N_Sound_Close() より前に入れること
  38.     N_Sound_Close();                                        //サウンドチャンネルを閉じる(終了時に呼んでください)
  39.     FlushEvents( everyEvent, 0 ); 
  40.     ShowMenuBar();
  41.     ColorRevert();
  42. }
  43.  
  44.